
<cfoutput>
<cfif isdefined("session.ReceiptNum")>
<CFQUERY NAME="getorders" DATASOURCE="#dsn#">
select *
from tblorders
where ReceiptNum = #session.ReceiptNum#
</CFQUERY>

<CFQUERY NAME="getitems" DATASOURCE="#dsn#">
select *
from tbltransactions, tblproducts
where ReceiptNum = #session.ReceiptNum# and tbltransactions.ProdID = tblproducts.ProdID
</CFQUERY>

<CFQUERY NAME="getitemssum" DATASOURCE="#dsn#">
select sum(Price) as total, sum(TaxAmount) as taxtotal
from tbltransactions
where ReceiptNum = #session.ReceiptNum#
</CFQUERY>

<cfif #getitemssum.taxtotal# gt 0>

<cfset myamount = #getitemssum.total# + #getitemssum.taxtotal#>
<cfelse>
<cfset myamount = #getitemssum.total#>

</cfif>

</cfif>
</cfoutput>
<!---<cfif isdefined("form.amountpaid")>
<cfset mychange = #form.amountpaid# - #form.Amount#>
<cfif #form.amountpaid# lt #form.Amount#>
<cfset myblance = #mychange#>
<cfelse>
<cfset myblance = 0>

</cfif>
<cfset today = dateformat(now(), "mm/dd/yyyy")>
<cfset mytime = timeformat(now(), "hh:mm:ss tt")>


<CFQUERY DATASOURCE="#dsn#">
update tblorders
set Cash = #amount#,
Change = #mychange#,
TransType = 'POS',
LastFour = #session.pin#


where ReceiptNum = #session.ReceiptNum#
</CFQUERY>


<CFQUERY DATASOURCE="#dsn#">
INSERT INTO tblpayments (Amount, ReceiptNum, TransDate, ReportTime, ReportDate, PaymentType, PIN, Change, username, amountpaid, Balance)
VALUES (
#Amount#,
#session.ReceiptNum#,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#today#">,
'#mytime#',
'#today#',
'CASH',
#session.pin#,
#mychange#,
'#session.username#',
#amountpaid#,
<cfif #myblance# gte 1>#myblance#<cfelse>0</cfif>
 
)
</CFQUERY>--->



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 14px;
	color: #FFFFFF;
}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #1b3b63;
}
.style1 {
	font-size: 18px;
	font-weight: bold;
}
.style2 {
	font-size: 18px;
	font-weight: bold;
	color:#666666;
}
-->
</style></head>

<body><cfoutput>
      <table width="100%" border="0" cellspacing="2" cellpadding="2" height="119">
        <tr>
          <td width="50%" height="26"><strong class="style1">Select Payment Type</strong></td>
          <td width="50%" align="right">Receipt Number: #session.ReceiptNum# Amount: #lscurrencyformat(myamount)#</td>
        </tr>
        <tr>
          <td colspan="2"><hr size="1" noshade="noshade" /></td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><p>&nbsp;</p>
            <table width="100%" border="0" cellspacing="4" cellpadding="4">
            <tr>
              <td align="center"><a href="cash.cfm?amount=#myamount#"><img src="../images/cash.png" alt="CASH" width="254" height="79" border="0" /></a></td>
              <td align="center"><img src="../images/check.png" width="254" height="79" /></td>
            </tr>
            <tr>
              <td align="center"><a href="credit.cfm?amount=#myamount#"><img src="../images/credit.png" alt="CREDIT" width="254" height="79" border="0" /></a></td>
              <td align="center"><img src="../images/giftcard.png" width="254" height="79" /></td>
            </tr>
          </table></td>
        </tr>
        <cfif not isdefined("form.amountpaid")></cfif>
      </table>
   </cfoutput>
    </td>
    </tr>
</table>
</body>
</html>
